<html>
<head>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>提现</title>
    {include file='common/header'}
    <link href="/static/home/mobile/css/reset_5.css" rel="stylesheet" type="text/css" />
    <link href="/static/home/mobile/css/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="/static/home/mobile/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/static/home/mobile/css/new_page.css" />
    <link href="/static/home/mobile/css/new_style.css" rel="stylesheet" type="text/css" />
    <style>
    	.member-form .item-box span{width:60px;}
    	.member-form .item-box .m_txt{width: calc(100% - 60px);}
    	body{background:#1f1f1f;color:#e2e2e2}
    	.zfb-count,.member-form .item-box,.member-form .item-box .m_txt,.user-gold{background:#1f1f1f;color:#fff}
    	.tixian_txt{background:#1f1f1f;color:#999}
    	.member-form .item-box,.zfb-count{    border-bottom: solid 1px #333;}
    </style>
</head>
<body>
    <header class="site-header header-fixed">
        <input type="hidden" id="taskId">
        <a onclick="history.back()" class="back"></a>
        <div class="tit-name" id="title_txt">提现</div>
    </header>
    <div class="new-top-up">
        <div class="update-box" id="hasZfb" style="">
			<div id="wx_bind">
				<div style="text-align: center;display:none;">
					<div id="qrcode"></div>
					
				</div>
				
				<div>提现注意：首次提现请上传微信或者支付宝收款二维码！</div>
			</div>	
			
            <form id="post_form" enctype="multipart/form-data">
                <div class="zfb-count" style="display: flex;display: -webkit-flex;justify-content: space-around;align-items: center;">
                    <label>
                        <input name="pay_method" checked style="-webkit-appearance: radio" onclick="set_pay_type(1)"  type="radio" value="2">微信
                    </label>
                    <label>
                        <input name="pay_method" style="-webkit-appearance: radio" onclick="set_pay_type(2)" type="radio" value="1">支付宝
                    </label>
                    
                </div>
                <div class="member-form">
                    <div class="item-box"><span>账号:</span>
                        <input type="text" name="account" id="account" value="{$member['tx_wx']?$member['tx_wx']:''}" class="m_txt" placeholder="请输入支付宝、微信账号">
                    </div>
                </div>
                <div class="member-form">
                    <div class="item-box"><span>姓名:</span>
                        <input type="text" name="realname" id="realname" value="{$member['alipay_realname']?$member['alipay_realname']:''}" class="m_txt" placeholder="请输入真实姓名">
                    </div>
                </div>

                <div class="member-form">
                    <div class="item-box"><span>收款码:</span>
                    	<i id="wx"  style="display:block;">
                			{if $member['wx_img']}
                				<input type="text"   value="已上传" class="m_txt"  readonly="readonly">
                			{else /}
                        <input type="file" name="wx_img" id="wx_img" style="padding-top:14px;" value="{$member['wx_img']?$member['wx_img']:''}" class="m_txt" placeholder="请上传微信收款码">
                        	{/if}
                       </i>
                       
                       
                       <i id="ali" style="display:none;">
                       		{if $member['ali_img']}
                				<input type="text"   value="已上传" class="m_txt"  readonly="readonly">
                			{else /}
                       	
                        		 <input type="file" name="ali_img" id="ali_img" style="padding-top:14px;" value="{$member['ali_img']?$member['ali_img']:''}" class="m_txt" placeholder="请上传微信收款码">
                        	 {/if}
                       </i>
                       
                       
                    </div>
                </div>


                <div class="user-gold">
                    <span>余额：<span class="user-gold-money" style="color: red">￥{$member['credit2']?$member['credit2']:0}</span></span>
                </div>
                
                <div class="member-form">
                    <div class="item-box"><span style="font-size: 21px;font-weight: bold">￥</span>
                        <input type="text" class="m_txt" id="my_tx" placeholder="请输入取现金额" name="credit2">
                    </div>
                    <div class="tixian_txt">
                        温馨提示：<br />
                        1、最低提现&nbsp;<span style="color: red">2</span>&nbsp;元，手续费&nbsp;<span style="color: red">{$setting['withdraw_fee']?$setting['withdraw_fee']:0}%</span>。<br />
                        2、提现24小时内到账。<br />
                        3、一天只能提现1次
                    </div>
                    <div class="member-btn">
                        <input type="button" class="button1" value="确认" style="color: #ffffff;background: #308CFC">
                    </div>
                </div>
            </form>
        </div>
    </div>
	

	<script src="/static/home/mobile/js/qrcode/jquery.qrcode.min.js"></script>

    <script type="text/javascript">
		var wx = "{$member['openid']}";
		if(wx!=''){
			// $('#wx_bind').css('display','none');
		}
		
		if($('#realname').val()!=''){
			$('#realname').attr("readonly","readonly");
		}
		$(':radio').click(function(){
			if($('input:radio[name="pay_method"]:checked').val()==1){
				$('#account').removeAttr("readonly");
				$('#account').val("{$member['alipay_account']?$member['alipay_account']:''}");
			}else{
				$('#account').val("{$member['tx_wx']?$member['tx_wx']:''}");

			}
		});
		if($('input:radio[name="pay_method"]:checked').val()==2 && "{$member['tx_wx']}"!=''){
			$('#account').attr("readonly","readonly");
		}
		
        $(function () {
          	
            $('.button1').click(function () {
              if($('#my_tx').val()>1000){
                message('单笔最高提现1000','','error');
                return false;
            }
            var a=0;
            if(a == 1) return;
           // $('.button1').attr('disabled',true);
            a=1;
            
            var pay_method=$('input:radio[name="pay_method"]:checked').val();
            
               var formData = new FormData($("#post_form")[0])  //创建一个forData 
    			if($('#wx_img').val() && pay_method == 2){
    					formData.append('wx_img', $('#wx_img')[0].files[0]) //把file添加进去  name命名为img
    			}
    			
    			if($('#ali_img').val() && pay_method == 1){
    					formData.append('ali_img', $('#ali_img')[0].files[0]) //把file添加进去  name命名为img
    			}
    		
     $.ajax({
        url: window.location.href,
        data: formData,
        type: "POST",
        async: false,
        cache: false,
        contentType: false,
        processData: false,
        success: function(ret) {
            a=0;
        	message(ret.message,ret.redirect,ret.type);
        },
        error: function() {
              //失败
        }
      })
      
    
/*                $.post(
                    window.location.href,
                    $('#post_form').serialize(),
                    function (ret) {
                    	a=0;
                        message(ret.message,ret.redirect,ret.type);
                    },'json'
                );
                */
                
            });
        });
		var qrurl = "{$qrurl}";
		$('#qrcode').qrcode({
				text: qrurl,
				render: "canvas",
				width : 150,
				height : 150
			});
			

    </script>
    <script>
    		function set_pay_type(type){
				if(type == 1){
					$("#wx").show()
					$('#ali').hide()
				}
				
				if(type == 2){
					$("#wx").hide()
					$('#ali').show()
				}
			}
    </script>
</body>
</html>